import os
from dashscope import Generation

def abc(msgs):
    resp = Generation.call(
        api_key=os.environ.get("DASHSCOPE_API_KEY"),
        model="qwen-plus",
        messages=msgs,
        result_format="message",
    )
    return resp
msgs = []

for i in range(3):
    m1 = input("请输入你的问题：")
    msgs.append({'role': 'user', 'content': m1})
    response = abc(msgs)
    if response.status_code == 200:
        print(response.output.choices[0].message.content)
        msgs.append({'role':'assistant', 'content': response.output.choices[0].message.content})
    else:
        print("出错了")

